package api.my_api;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Test6 {
    public static void main(String[] args) throws ParseException {
        Date d1 = new Date();
        System.out.println(d1);
        Date d2 = new Date(System.currentTimeMillis());
        System.out.println(d2);
        System.out.println("==========================================");

        // 格式化
        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SS").format(new Date()));
        // 解析
        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("1997-7-7 11:11:11"));
    }
}
